<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        var n =10;
        const list = [];
        list[0] = 1;
        list[1] = 1;
        for (var i = 2; i <= n; i++) {
            //计算的值放在list数组中
            list[i] = list[i - 1] + list[i - 2];
        }
        //最后的 n 就是需要求的多少种方法可以爬 n 楼
        console.log(list[n]);
    </script>
</body>

</html>